TOOLPATH = ../z_tools/
INCPATH  = ../z_tools/haribote/
FUNCPATH = apps\\func\\

MAKE     = $(TOOLPATH)make.exe -r
EDIMG    = $(TOOLPATH)edimg.exe
IMGTOL   = $(TOOLPATH)imgtol.com
COPY     = copy
DEL      = del
#hrb
# 默认动作

default :
	$(MAKE) Douglax.img

# 文件生成规则

Douglax.img : Douglax/ipl20.bin Douglax/Douglax.sys Makefile \
		apps/invader/invader.dou apps/txz/txz.dou \
		apps/wincalc/wincalc.dou apps/gview/gview.dou apps/mine/mine.dou \
		apps/notepad/notepad.dou apps/folder/folder.dou \
		apps/ab_shell/ab_shell.dou apps/sconfig/sconfig.dou \
		apps/clock/clock.dou apps/cat/cat.dou apps/jzq/jzq.dou
	$(EDIMG)   imgin:../z_tools/fdimg0at.tek \
		wbinimg src:Douglax/ipl20.bin len:512 from:0 to:0 \
		copy from:Douglax/Douglax.sys to:@: \
		copy from:apps/invader/invader.dou to:@: \
		copy from:apps/wincalc/wincalc.dou to:@: \
		copy from:apps/mmlplay/mmlplay.dou to:@: \
		copy from:apps/mine/mine.dou to:@: \
		copy from:apps/clock/clock.dou to:@: \
		copy from:apps/notepad/notepad.dou to:@: \
		copy from:apps/folder/folder.dou to:@: \
		copy from:apps/gview/gview.dou to:@: \
		copy from:apps/cat/cat.dou to:@: \
		copy from:apps/ab_shell/ab_shell.dou to:@: \
		copy from:apps/sconfig/sconfig.dou to:@: \
		copy from:apps/jzq/jzq.dou to:@: \
		copy from:apps/txz/txz.dou to:@: \
		copy from:datas/mmldata/kirakira.mml to:@: \
		copy from:datas/mmldata/fujisan.mml to:@: \
		copy from:datas/mmldata/daigo.mml to:@: \
		copy from:datas/mmldata/daiku.mml to:@: \
		copy from:datas/pictdata/fujisan.jpg to:@: \
		copy from:datas/pictdata/cmd.jpg to:@: \
		copy from:datas/pictdata/mine.jpg to:@: \
		copy from:datas/pictdata/folder.ico to:@: \
		copy from:datas/pictdata/folder.jpg to:@: \
		copy from:datas/pictdata/clock.jpg to:@: \
		copy from:datas/pictdata/notepad.jpg to:@: \
		copy from:datas/pictdata/invader.jpg to:@: \
		copy from:datas/pictdata/calc.jpg to:@: \
		copy from:datas/pictdata/tetris.jpg to:@: \
		copy from:datas/pictdata/box.jpg to:@: \
		copy from:datas/pictdata/1tek.png to:@: \
		copy from:datas/pictdata/desktop2.jpg to:@: \
		copy from:datas/pictdata/desktop3.jpg to:@: \
		copy from:datas/pictdata/computer.jpg to:@: \
		copy from:datas/pictdata/night.bmp to:@: \
		copy from:datas/chinese/swwb.txt to:@: \
		copy from:datas/chinese/chinese.fnt to:@: \
		copy from:datas/nihongo/nihongo.fnt to:@: \
		imgout:Douglax.img

# 命令

run :
	$(MAKE) Douglax.img
	$(COPY) Douglax.img ..\z_tools\qemu\fdimage0.bin
	$(MAKE) -C ../z_tools/qemu

install :
	$(MAKE) Douglax.img
	$(IMGTOL) w a: Douglax.img

full :
	$(MAKE) -C apilib
	$(MAKE) -C stdlib
	$(MAKE) -C Douglax
	$(MAKE) -C apps/a
	$(MAKE) -C apps/txz
	$(MAKE) -C apps/invader
	$(MAKE) -C apps/wincalc
	$(MAKE) -C apps/gview
	$(MAKE) -C apps/tetris
	$(MAKE) -C apps/notepad
	$(MAKE) -C apps/folder
	$(MAKE) -C apps/clock
	$(MAKE) -C apps/mine
	$(MAKE) Douglax.img

run_full :
	$(MAKE) full
	$(COPY) Douglax.img ..\z_tools\qemu\fdimage0.bin
	$(MAKE) -C ../z_tools/qemu

install_full :
	$(MAKE) full
	$(IMGTOL) w a: Douglax.img

run_os :
	$(MAKE) -C Douglax
	$(MAKE) run

clean :
#不执行任何操作

src_only :
	$(MAKE) clean
	-$(DEL) Douglax.img

clean_full :
	$(MAKE) -C Douglax	clean
	$(MAKE) -C apilib		clean
	$(MAKE) -C stdlib		clean
	$(MAKE) -C apps/a	  clean
	$(MAKE) -C apps/txz	clean
	$(MAKE) -C apps/mine	    clean
	$(MAKE) -C apps/invader	  clean
	$(MAKE) -C apps/wincalc	  clean
	$(MAKE) -C apps/gview 	  clean
	$(MAKE) -C apps/tetris 	  clean
	$(MAKE) -C apps/notepad	  clean
	$(MAKE) -C apps/clock 	  clean
	$(MAKE) -C apps/folder	  clean

src_only_full :
	$(MAKE) -C Douglax	src_only
	$(MAKE) -C apilib		src_only
	$(MAKE) -C stdlib		src_only
	$(MAKE) -C apps/a		src_only
	$(MAKE) -C apps/txz	src_only
	$(MAKE) -C apps/invader		src_only
	$(MAKE) -C apps/wincalc		src_only
	$(MAKE) -C apps/gview 		src_only
	$(MAKE) -C apps/mine 		  src_only
	$(MAKE) -C apps/tetris	  src_only
	$(MAKE) -C apps/notepad   src_only
	$(MAKE) -C apps/folder    src_only
	$(MAKE) -C apps/clock     src_only
	-$(DEL) Douglax.img
	$(COPY) $(FUNCPATH)bmp.obj $(FUNCPATH)bmp.bak 
	-$(DEL) $(FUNCPATH)*.lst
	-$(DEL) $(FUNCPATH)*.nas
	-$(DEL) $(FUNCPATH)*.gas
	-$(DEL) $(FUNCPATH)*.obj
	$(COPY) $(FUNCPATH)bmp.bak  $(FUNCPATH)bmp.obj
	-$(DEL) $(FUNCPATH)*.bak

refresh :
	$(MAKE) full
	$(MAKE) clean_full
	-$(DEL) Douglax.img
